package com.tgb.manager;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.tgb.dao.TeacherDao;
import com.tgb.entity.Teacher;
@Service//声明是业务层的组件
@Transactional//对类中所有方法采用默认的事务管理
public class TeacherManagerImpl implements TeacherManager {
	@Autowired 
    private TeacherDao teacherDao;  
     
	@Transactional(propagation=Propagation.REQUIRED)
    public void setTeacherDao(TeacherDao teacherDao) {  
        this.teacherDao = teacherDao;  
    }  
  
	@Override
	public Teacher getTeacher(String id) {
		// TODO Auto-generated method stub
		return teacherDao.getTeacher(id);
	}

	@Override
	public List<Teacher> getAllTeacher() {
		// TODO Auto-generated method stub
		return teacherDao.getAllTeacher();
	}

	@Override
	public void addTeacher(Teacher teacher) {
		// TODO Auto-generated method stub
		teacherDao.addTeacher(teacher);
	}

	@Override
	public boolean delTeacher(String id) {
		// TODO Auto-generated method stub
		return teacherDao.delTeacher(id);
	}

	@Override
	public boolean updateTeacher(Teacher teacher) {
		// TODO Auto-generated method stub
		return teacherDao.updateTeacher(teacher);
	}

}
